﻿namespace LanSunERP
{
    using System;
    using System.ServiceModel;
    using System.Windows.Forms;
    using System.Diagnostics;
    using System.Collections.Generic;
    using System.Runtime.Serialization;
    using System.Collections;
    using System.Data;
    using System.Data.SqlClient;

    public class GoodsMastCreatCond:QueryCommand
    {
             public GoodsMastCreatCond() : base () { }
             public GoodsMastCreatCond(SqlCommand cmdSQL, DataTable dtRequest,string RequestJob)
         : base(cmdSQL, dtRequest,RequestJob) {  }

        public SqlCommand BuildCommand()
        {
           switch (RequestJob.Substring(6, 10))
            {
                case "0000": break;
                case "1000": break;
                case "1001":
                    cmdSQL.Parameters.Add(new SqlParameter("@SysID", dwRequest["SysID"].ToString()));
                    break;
                case "1002": break;
                case "2000": 
                case "3000":
                    cmdSQL.Parameters.Add(new SqlParameter("@SysID", dwRequest["SysID"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@InstanceID", dwRequest["InstanceID"].ToString()));
                    cmdSQL = BuildInstanceKey(cmdSQL, dwRequest);
                    cmdSQL.Parameters.Add(new SqlParameter("@BaseSysID", dwRequest["BaseSysID"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@BaseGoodsType", dwRequest["BaseGoodsType"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@BaseGoodsTypeKeyDefID", dwRequest["BaseGoodsTypeKeyDefID"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@BaseInstanceID", dwRequest["BaseInstanceID"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@BaseInstanceKey", dwRequest["BaseInstanceKey"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@BaseInstanceType", dwRequest["BaseInstanceType"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@BaseLevels", dwRequest["BaseLevels"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@NextLevels", dwRequest["NextLevels"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@NextSysID", dwRequest["NextSysID"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@NextGoodsType", dwRequest["NextGoodsType"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@NextGoodsTypeKeyDefID", dwRequest["NextGoodsTypeKeyDefID"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@NextInstanceType", dwRequest["NextInstanceType"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@NextGoodsKey", dwRequest["NextGoodsKey"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@SubStatus", dwRequest["SubStatus"].ToString()));
                    cmdSQL.Parameters.Add(new SqlParameter("@Status", dwRequest["Status"].ToString()));
                    
                    break;
                case "2001":case "4000":
                    cmdSQL.Parameters.Add(new SqlParameter("@InstanceID", dwRequest["InstanceID"].ToString()));
                    break;
            }
             return cmdSQL;

        }      

    }
}